const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin');
const CracoLessPlugin = require('craco-less');
const path = require('path');

const pathResolve = pathUrl => path.join(__dirname, pathUrl);
module.exports = {
    eslint:{
        enable:false,
    },
  webpack: {
    alias: {
      '@@': pathResolve('.'),
      '@': pathResolve('src'),
      '@assets': pathResolve('src/assets'),
      '@common': pathResolve('src/common'),
      '@components': pathResolve('src/components'),
      '@hooks': pathResolve('src/hooks'),
      '@pages': pathResolve('src/pages'),
      '@store': pathResolve('src/store'),
      '@utils': pathResolve('src/utils')
      // 此处是一个示例，实际可根据各自需求配置
    },
    plugins: [
      new AntdDayjsWebpackPlugin(),
    ]
  },
  babel: {
    plugins: [
      ['import', { libraryName: 'antd', style: true }],
    ]
  },
    plugins: [
      {
          plugin: CracoLessPlugin,
          options: {
              lessLoaderOptions: {
                  lessOptions: {
                      modifyVars: {
                        // '@primary-color': '#1DA57A'
                        // '@primary-color': '#fff'
                      },
                      javascriptEnabled: true,
                  },
              },
          },
      },

    ],
  devServer: {
    proxy: {
      "/api": {
        target: "http://localhost:8886",//综合监测 - 服务地址
        changeOrigin: true,
        pathRewrite: {
          "^/api": ""
        }
      },
    }
  }
};
